<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 1、字面量创建
    var obj = {
        name:'zs',
        color:'red'
    }
    // 2、new Object()
    let obj_1 = new Object()
    obj_1.name = 'zs'
    console.log(obj_1);
    // 3、工厂函数
    function car(name){
        let car = new Object()
        car.name = name
        return car
    }
    let car_1 = car('小米')
    console.log(car_1);
    // 4、构造函数
    function Car_2(name,color){
        this.name = name
        this.color = color
    }
    let car_3 = new Car_2('小米','红色')
    console.log(car_3);
</script>
</html>